<template>
  <div class="rms-eq-details">
    <div class="query-container">
      <el-form inline
               label-width="90px">
        <el-form-item label="年份"
                      :required="true">
          <el-select v-model="particularYear"
                      style="width: 226px"
                      placeholder="请选择年份"
                      @input="clearYear">
            <el-option v-for="item in yearList"
                       :key="item.id"
                       :label="item.name"
                       :value="item.name"/>
          </el-select>
        </el-form-item>
        <el-form-item label="发货方名称"
                      v-if="menuId == 316">
          <el-input v-model="params.customerName"
                      style="width: 226px"
                      placeholder="请输入发货方名称"></el-input>
        </el-form-item>
        <el-form-item label="承运方名称"
                      v-if="menuId == 330">
          <el-input v-model="params.carrierName"
                    style="width: 226px"
                    placeholder="请输入承运方名称"></el-input>
        </el-form-item>
        <el-form-item style="width:202px;float: right">
          <el-button type="primary"
                     icon="el-icon-search"
                     @click="search(1)">查询</el-button>
          <el-button type="primary"
                     icon="el-icon-delete"
                     @click="resetForm">清除</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="bottom-container">
      <el-form>
        <el-form-item style="float: right">
          <el-button type="default"
                     icon="el-icon-s-promotion"
                     @click="handleExport">导出</el-button>
        </el-form-item>
      </el-form>
      <el-table class="table-container"
                stripe
                border
                :data="tableData"
                v-loading="loading"
                element-loading-text="加载中"
                element-loading-spinner="el-icon-loading"
                show-summary
                :summary-method="getSummaries"
                @sort-change="sortChange">
        <el-table-column
            v-if="menuId===316"
            prop="name"
            label="发货方名称"
            width="240"
            sortable="custom"
          ></el-table-column>
          <el-table-column v-else prop="name" label="承运方名称" width="240" sortable="custom"></el-table-column>
          <el-table-column
          v-for="(column, index) in columns"
            :key="index"
            :prop="column.prop"
            :label="column.name"
            :align="column.align?column.align:'right'"
          >
            <template slot-scope="scope">
              <el-tooltip class="item" effect="dark" 
                :content="textTyep(scope.row[column.bound], scope.row[column.total])" 
                placement="top-start">
                <span>{{digitalConversion(scope.row[column.prop])}}</span>
              </el-tooltip>
            </template>
          </el-table-column>
      </el-table>
      <span v-show="tableData.length > 0" 
            style="color: var(--prev-color-primary);">说明:由于四舍五入的原因，本页合计和总合计可能存在误差。</span>
      <el-pagination v-show="tableData.length > 0"
                     background
                     layout="total, sizes, prev, pager, next, jumper"
                     :total="total"
                     :page-sizes="pageSizeOptions"
                     :page-size.sync="pageSize"
                     :current-page.sync="pageNo"
                     @size-change="handleSizeChange"
                     @current-change="handleCurrentChange">
      </el-pagination>
    </div>
  </div>
</template>

<script src="./rmsJs/RmsEqDetails.js"></script>

<style scoped>
.table-container >>> .el-table__body-wrapper {
  height: calc(100% - 168px);
  overflow-y: auto;
}
.bottom-container >>> .el-pagination {
  margin-top: 20px;
  /* text-align: right; */
}
.bottom-container >>> .el-table tr {
  background-color: var(--prev-bg-white);
  height: 50px;
  font-size: 14px;
}
.rms-eq-details >>> .el-table th.el-table__cell.is-leaf,
.el-table td.el-table__cell {
  border-bottom: 1px solid var(--prev-border-color-lighter);
  font-size: 14px;
  font-family: PingFang SC;
  font-weight: 400;
  line-height: 20px;
  color: #333333;
  opacity: 1;
}
</style>
<style lang="scss" scoped>
.rms-eq-details {
  width: 100%;
  height: 100%;
  .query-container {
    padding: 20px 20px 20px 0;
    background: var(--prev-bg-white);
  }
  .bottom-container {
    padding: 20px;
    margin-top: 12px;
    background: var(--prev-bg-white);
    height: calc(100vh - 270px);
    .table-container {
      height: calc(100% - 100px);
      .target-power {
        display: flex;
        .power {
          display: flex;
          align-items: center;
        }
      }
    }
  }
}
</style>
